VBScript/VBScript Mcq Question Set 2 Sample Test,Sample questions

Question:
 A Do?Loop Until block is always executed at least once

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
 Suppose that the selector in a Select Case block is the string variable myVar. Which of the following is NOT a valid Case clause?

1.Case “Adams”

2.Case “739”

3.Case (myVar.Substring(0, 1)

4.Case myVar.Length


Question:
 The arguments appearing in a Call statement must match the parameters in the appropriate Sub or Function header in all but one of the following ways. Which one?

1.Number of arguments

2.Names of arguments

3. Data type of arguments

4. Order of arguments


Question:
 The declaration statement for a class-level variable should be placed _____

1. inside an event procedure

2. inside a general procedure

3. anywhere in the program region, except inside a procedure

4.above the statement Public Class frmName


Question:
 The input to a user-defined function can consist of one or more values.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
 The statement Const TAX_RATE As Doubleface=Calibri size=2> is not valid.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
: A
51. Suppose a variable is passed by value to a parameter of a Sub procedure, and the parameter has its value changed inside the Sub procedure. What will the value of the variable be after the Sub procedure has executed?

1.It will have the newly modified value from inside the Sub procedure.

2.Its value can?t be determined without more information

3.It will retain the value it had before the call to the Sub procedure

4.None of the above.


Question:
A counter variable is normally incremented or decremented by 1.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
A Do While loop checks the While condition before executing the statements in the loop.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
A Function may return up to two values.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
A single Case statement can contain multiple values.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
A variable declared inside a Select Case block cannot be referred to by code outside of the block.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
Although a function can return a value, it cannot directly display information in a text box.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
Both the input and output of a Function procedure can consist of several values.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
Different items appearing in the same value list of a Select Case block must be separated by a ______

1. semi colon

2. comma

3. colon

4. pair of quotation marks


Question:
Each individual variable in the list student(0), student(1), student(2) is known as a(n)

1. subscript

2. dimension

3.element

4.Type


Question:
Function names should be suggestive of the role performed. The names also must conform to the rules for naming variables.

1.True

2. False

3.all of the above

4.None of the mentioned


Question:
Function procedures can invoke other Function procedures.

1. True

2. False

3.all of the above

4.None of the mentioned


Question:
Suppose a variable is passed by reference to a parameter of a Sub procedure, and the parameter has its value changed inside the Sub procedure. What will the value of the variable be after the Sub procedure has executed?

1. It will have the newly modified value from inside the Sub procedure.

2.Its value can?t be determined without more information.

3.It will retain the value it had before the call to the Sub procedure

4.None of the above.


Question:
Suppose the variable myName is declared in a Dim statement in two different Sub procedures. Which statement is true?

1.The program will malfunction when it is executed.

2. When the value of myName is changed in one Sub procedure, it will also be changed in the other Sub procedure.

3.Visual Basic’s smart editor will alert you that this is an error before the program is executed.

4.The two variables will be local to their respective Sub procedures.


Question:
Suppose you want to write a procedure that takes three numbers, num1, num2, and num3; and returns their sum, product, and average. It is best to use a Function procedure for this task.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
The body of a For…Next loop in Visual Basic will always be executed once no matter what the initial and terminating values are.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
The body of a For…Next loop in Visual Basic will always be executed once no matter what the initial and terminating values are.  duplicate question?

1.True

2. False

3.all of the above

4.None of the mentioned


Question:
The input to a user-defined function can consist of:

1.a single value

2.one or more values

3.no values

4. All of the above


Question:
The value of the control variable should not be altered within the body of a For?Next loop.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
The _________ of a Sub procedure are vehicles for passing numbers and strings to the Sub procedure.

1. Call Statements

2.arguments

3.parameters

4. variables declared inside


Question:
Variables appearing in the header of a Function procedure are called ____

1.values of the function

2.parameters

3.coordinates

4.arguments


Question:
Variables declared inside a procedure are said to have _____

1. local scope

2.procedure-level scope

3.class-level scope

4.none of the above


Question:
What happens to a variable declared locally inside a Sub procedure after the procedure terminates?

1. It maintains its value even after the End Sub statement executes.

2.It ceases to exist after the End Sub statement executes.

3.It loses its value temporarily after the End Sub statement executes, but regains that value upon re-entry to the Sub procedure.

4.It is reset to its default value.


Question:
What is displayed when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim a, b as String
Dim x as Integer
a = “How now brown cow.”
b = “brown”
x = FindIt(a, b)
txtBox.Text = CStr(x)
End Sub
Function FindIt(ByVal z1 as String, ByVal z2 as String) As Integer
Dim x as Integer
x = z1.IndexOf(z2)
End Function
“How now”

1. 8

2.0

3.An error

4. None of the above


Question:
What type of items are valid for use in the value list of a Case clause?

1. literals

2.variables

3.expressions

4.All of the above


Question:
What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim number As Double = 3
DoubleAndSquare(number)
txtBox.Text = CStr(number)
End Sub
Sub DoubleAndSquare(ByRef myVar As Double)
myVar = myVar + myVar
myVar = myVar * myVar

1. 3

2.36

3.6

4.0


Question:
What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim word, result As String
word = “Benjamin”
result = Rotate(word)
result = Rotate(result & word)
result = Rotate(result)
txtBox.Text = result
End Sub
Function Rotate(ByVal var As String) As String
Dim varlength As Integer
varlength = var.Length
Return var.Substring(1) & var.Substring(0, 1)
End Function

1. jaminBBenjaminen

2.BenjaminBenjamin

3.njaminBe

4.None of the above.


Question:
Which Case clause will be true whenever the value of the selector in a Select Case block is between 1 and 5 or is 8?

1.Case 1 To 8

2.Case 1 To 5, 8

3.Case 1 To 8, 5

4.Case 1 To 5; 8


Question:
Which Case clause will be true whenever the value of the selector in a Select Case block is greater than or equal to 7?

1. Case Is >7

2. Case Is = 8

3. Case Is >= 7

4. Case Is <= 8


Question:
Which of the following is NOT a reason for using procedures?

1. They break a complex problem down into smaller pieces.

2.They make a program run faster.

3. They can be reused easily.

4. They make it possible for a team of people to work together on a single program.


Question:
Which of the following statements is guaranteed to pass the variable numVar by value to the Sub procedure Tally?

1. Tally(numVar)

2.Tally(ByVal numVar)

3. Tally((numVar))

4. Tally(ByVal numVar As Double)


Question:
Which one of the following is true about arguments and parameters?

1.Arguments appear in Call statements; parameters appear in Sub statements.

2.Parameters appear in Call statements; arguments appear in Sub statements.

3.They are synonymous terms.

4. They are completely unrelated in a program.


Question:
You can specify a range of values in a Case clause by using the To keyword.

1.True

2.False

3.all of the above

4.None of the mentioned


More MCQS

  1. VBScript Mcq Question Set 1
  2. VBScript Mcq Question Set 2
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!